﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using C1.Win.C1Ribbon;
using CWCS.Entity.SRM;

namespace CWCS.UI
{
    public partial class Frmreworknormalinfo : C1RibbonForm
    {
        BLL.ConveryBLL bll = new BLL.ConveryBLL();
        public Frmreworknormalinfo()
        {
            InitializeComponent();

        }

        private void button1_Click(object sender, EventArgs e)
        {
           
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            if (textBox1.Text == null || textBox1.Text.Length != 8)
            {
                MessageBox.Show("请输出正确的托盘条码！");
                return;
            }
            String[] StaStationInfo = bll.ReadStationInfo("1013");
            string[] TaskInfo = new string[8];
            for (int i = 1; i < 8; i++)
            {
                TaskInfo[i] = StaStationInfo[i];
            }
            STACommand cmd = STACommand.ReWrite;
            string msg = string.Empty;
#pragma warning disable CS0219 // 变量“result”已被赋值，但从未使用过它的值
            int result = 0;
#pragma warning restore CS0219 // 变量“result”已被赋值，但从未使用过它的值
            TaskInfo[1] = "1000";
            TaskInfo[2] = textBox1.Text;
            TaskInfo[3] = "5";
            TaskInfo[5] = "1013";
            TaskInfo[7] = "0";
            cmd = STACommand.ReWrite;
            if (bll.WriteStationInfo(cmd, TaskInfo, "1013", 0, 22))//写入PLC信息
            {
                MessageBox.Show("请申请任务写入成功！");
                bll.ShowConveryLog("WriteInfo", "站台：" + "1013" + msg + "手动写入PLC成功！任务号：" + TaskInfo[0]);
            }
            else
            {
                bll.ShowConveryLog("WriteInfo", "站台：" + "1013" + msg + "手动写入PLC失败！任务号：" + TaskInfo[0]);
            }
            

        }
    }
}
